'use strict';
var Schema = require('mongoose').Schema,
    Model = require('../../../Base/server/controllers/Model');

var modelField = {};
modelField.BarcodeMaster = {
    type: Schema.ObjectId,
    ref: 'BarcodeMaster',
    Name: '条码主档'
};
modelField.DeliveryRecord = {
    type: Schema.ObjectId,
    ref: 'DeliveryRecord',
    Name: '配送记录',
    IsEmpty: false
};
modelField.ItemMaster = {
    type: Schema.ObjectId,
    ref: 'ItemMaster',
    Name: '物料',
    IsEmpty: false
};
modelField.Qty = {
    type: Number,
    Name: '配送数量',
    IsEmpty: false
};
modelField.DescSeg1 = {
    type: String,
    default: '',
    trim: true,
    Name: '扩展字段1'
};
modelField.DescSeg2 = {
    type: String,
    default: '',
    trim: true,
    Name: '扩展字段2'
};
modelField.DescSeg3 = {
    type: String,
    default: '',
    trim: true,
    Name: '扩展字段3'
};

var newModel = new Model(modelField);
newModel.addIndex({DeliveryRecord: 1, BarcodeMaster: 1});
newModel.create('DeliveryDetails', '配送明细');